package com.jxbai.design.pattern.dcxy.singleton;

/**
 * 双重检验锁单例
 * @author jxbai
 * @date 2021/12/13
 */
public class DclSingleton {

    private static volatile DclSingleton instance;

    private DclSingleton() {

    }

    public static DclSingleton getInstance() {
        if (instance == null) {
            synchronized (DclSingleton.class) {
                if (instance == null) {
                    instance = new DclSingleton();
                }
            }
        }
        return instance;
    }
}
